package book;

import user.AdminUser;
import user.NomalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28792
 * Date: 2023-11-19
 * Time: 9:50
 */
public class Main {
    public static User login() {
        System.out.println("请输入你的名字：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入你的身份：1. 管理员  2. 普通用户");
        int choice = scanner.nextInt();
        if (choice == 1) {
            return new AdminUser(name);
        } else {
            return new NomalUser(name);
        }
    }

    public static void main(String[] args) {
        User user = login();
        BookList bookList = new BookList();
        //根据choice来进行你的操作
        while (true) {
            int choice = user.Menu();
            user.doOperation(choice, bookList);
        }
    }
}

